define(function(require, exports, module) {
    var query = {
        proxy: '/homepage/proxy/search.php',
        debug: true
    };
    var rest = require('rest');

    query.search = function(opts, callback) {
        var pageSize = 50;
        var keyword = opts.keyword;
        var params = {
            'q': keyword,
            'pn': pageSize
        };
        (typeof(opts.pageNum) !== 'undefined') && (params['sn'] = opts.pageNum * pageSize);
        rest.get(this.proxy, params, function(data){
            callback(data);
        });
    };

    return query;
});
